package com.blstudio;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.webkit.WebSettings;
import android.webkit.WebSettings.LayoutAlgorithm;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class webkitContainer extends Activity {
	
	WebView webview;
	String baseURL = "http://nicegametv.ongamenet.com/bbs/";
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.webkitcontainer);
        
        Log.d("webkit",  this.getIntent().getStringExtra("URL"));
        
        webview = (WebView) findViewById(R.id.webview);
        webview.setWebViewClient(new HelloWebViewClient());
        
        webview.getSettings().setJavaScriptEnabled(true);
        webview.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
        webview.getSettings().setDefaultTextEncodingName("euc-kr");
        webview.getSettings().setSupportMultipleWindows(true);
        webview.getSettings().setSupportZoom(true);
        webview.getSettings().setLoadsImagesAutomatically(true);      
        webview.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
        webview.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
        webview.getSettings().setPluginsEnabled(true);
        
        String Data = HtmlParser.getInstance().getRightcontents( this.getIntent().getStringExtra("URL") );
        Data = "<html><body>"+ Data +"</body></html>";
        webview.loadDataWithBaseURL( baseURL , Data , "text/html", "UTF-8", "");
        
                
    }
    
    
    private class HelloWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return true;
        }
    }
}